package com.cn.ysf.newbeemall.util;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author ysf
 * @date 2019/12/3 18:35
 */
public class PageQueryUtil extends LinkedHashMap<String,Object> {

    //当前页码
    private int page;
    //每页条数
    private int limit;


    public PageQueryUtil(Map<String,Object> params){
        this.putAll(params);
        this.page=Integer.parseInt(params.get("page").toString());
        this.limit=Integer.parseInt(params.get("limit").toString());
        //每次查询的起始位置
        this.put("start", (page - 1) * limit);
        //页码
        this.put("page", page);
        //每页条数
        this.put("limit", limit);
    }
    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }







}
